// 用户请求
import request from '@/http/request'

export const login = (data) => {
  return request({
    // method: 'POST',
    // url: '/mp/v1_0/authorizations',
    method: 'POST',
    url: 'login',
    headers: {
      Authorization: `${data}`
    }
  })
}

export const loginExtra = (data) => {
  return request({
    // method: 'POST',
    // url: '/mp/v1_0/authorizations',
    method: 'POST',
    url: 'login-extra',
    headers: {
      Authorization: `${data}`
    }
  })
}

export const logout = () => {
  return request({
    method: 'POST',
    url: 'logout'
  })
}

export const getUserProfile = () => {
  return request({
    method: 'GET',
    url: '/user/profile'
  })
}

// 这里data必须传递formData对象
export const updataUserPhoto = data => {
  return request({
    method: 'POST',
    url: '/user/photo',
    data
  })
}

// 更新用户信息
export const upadataUserprofile = data => {
  return request({
    url: '/user/profile',
    method: 'POST',
    data
  })
}

export const getVerificationCode = data => {
  return request({
    url: '/notechecks',
    method: 'POST',
    data
  })
}

export const register = data => {
  return request({
    url: '/register',
    method: 'POST',
    headers: {
      Authorization: `${data}`
    }
  })
}

export const doSubmitByCode = data => {
  return request({
    url: '/doSubmitByCode',
    method: 'POST',
    headers: {
      Authorization: `${data}`
    }
  })
}

export const resetPwd = data => {
  return request({
    url: '/resetPwd',
    method: 'POST',
    headers: {
      Authorization: `${data}`
    }
  })
}
